<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Instituto Missionário de Ensino El Shaday</title>
    <link rel="stylesheet" href="css/gemepde.css"  />
</h:head>
<h:body style="font-size: 14px;">
	<div id="geral">
		<h:form id="formCadastro" enctype="multipart/form-data">
			<p:growl id="messages" showDetail="false" />
			<p:panel header="Cadastro de Aluno" style="margin:5px; width: auto;">
				<p:panelGrid>
					<p:row>
						<!-- campo de observações -->
						<p:column colspan="7" style="padding-left: 15px;">
							<h:outputLabel for="observacoes" value="Observações: " />
							<br />
							<p:inputTextarea id="observacoes" rows="5" cols="150"
								/>
						</p:column>
					</p:row>

					<p:row><!-- upload dos arquivos de observações -->
						<p:column colspan="7" style="padding-left: 15px; padding-right: 15px;">
							<h:form id="formUploadObs" enctype="multipart/form-data">
								<h:outputLabel for="legenda-obs" value="Nome para o arquivo : " /><br />
					    		<p:inputText id="legenda-obs" size="60" value="#{alunoBean.nomeArquivoObservacao}"/>
					    		<p:fileUpload mode="simple" id="upload-obs" style="padding: 0 75px 10px 75px;" value="#{alunoBean.uploadFileObservacao}"/>
					    		<p:commandButton value="Anexar Arquivo" ajax="false" actionListener="#{alunoBean.handleFileUploadObservacao}" update="@([id$=tableArqObs])"/>
							</h:form>
						</p:column>
					</p:row>
					
					<p:row>
						<p:column colspan="7">
							<p:dataGrid id="tableArqObs" var="arquivo" value="#{alunoBean.listaArquivosObservacao}" rendered="#{not empty alunoBean.listaArquivosObservacao}"
								columns="1" rows="5" paginatorAlwaysVisible="false" paginator="true"
								effect="true" 
								paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
								rowsPerPageTemplate="5, 10, 20, 30, 60">
								
								<div class="image-data">
									<h:outputLabel value="#{arquivo.nome}" style="color: gray;" />
									<div align="right" style="float: right; display: block;">
										<p:commandButton icon="ui-icon-trash" actionListener="#{alunoBean.removerArquivoObs}" update="tableArqObs" ajax="false" value="Excluir">
											<f:param name="arquivo" value="#{arquivo}" />
										</p:commandButton>
									</div>
								</div>
							</p:dataGrid>
						</p:column>
					</p:row>

				    <p:row> <!-- campo de informações -->
				    	<p:column colspan="7" style="padding-left: 15px;">
				    		<h:outputLabel for="informacoes" value="Campo de Informações: " /> <br />
							<p:inputTextarea id="informacoes" rows="5" cols="150" />
				    	</p:column>
				    </p:row>
				    
			   	</p:panelGrid>
			   	
				<f:facet name="footer">  
					<h:outputLabel style="padding-left: 600px;"/>
					<p:commandButton id="btn-cancelar" action="#{alunoBean.cancelarCadastro()}" value="Cancelar" icon="ui-icon-closethick" style="margin:0"/>
					<h:outputLabel style="padding-left: 100px;"/>
					<p:commandButton id="btn-reset" type="reset" value="Limpar" icon="ui-icon-minusthick" style="margin:0"/>
					<h:outputLabel style="padding-left: 100px;"/>
			        <p:commandButton id="btn-salvar" action="#{alunoBean.salvarAluno()}" value="#{alunoBean.tipoBotaoCadastro}" icon="ui-icon-disk" style="margin:0" />
			    </f:facet>
			   	
			</p:panel>
		</h:form>
	</div>	
</h:body>
</html>